from selenium import webdriver
from selenium.webdriver.common.by import By
import time

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC


# 打开浏览器
driver = webdriver.Chrome()
# 设置浏览器最大化
driver.maximize_window()
# 打开网站
driver.get("https://sales.jingxiansuo.com/#/searchCustomer/advanced-search")
time.sleep(2)

# 输入账号密码，并点击登录
driver.find_element(By.XPATH, '//*[@id="username"]').send_keys("15759225258")
driver.find_element(By.XPATH, '/html/body/div/div/div[2]/div[2]/div/form/div[4]/div/div/span/span/input').send_keys("Fh20240101")
driver.find_element(By.XPATH, '/html/body/div/div/div[2]/div[2]/div/form/button').click()
time.sleep(3)

# 点击找线索
driver.find_element(By.XPATH, '/html/body/div/div/section/aside/div/ul/li[1]/ul/li[4]/a').click()
time.sleep(2)

# # 点击以保存的筛选条件
driver.find_element(By.XPATH, "//*[@id='layout']/main/div[1]/").click()

WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "myElementId")))
# # 点击第一个模板的使用
driver.find_element(By.XPATH,'/html/body/div[3]/div/div[2]/div/div[2]/div[2]/div/div/div[3]/div[2]/div[2]/div/div/div/div/div/div/div/div/div/div[1]/div/div[2]/div[2]/button').click()



# 显示等待
time.sleep(200)
print("测试成功")